package com.example.love_margin.Controller;


import com.example.love_margin.Service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@Api(value = "用户",tags = "管理用户")
@RestController
@RequestMapping(value = "/User",name = "用户")
@CrossOrigin
public class UserController {

    @Autowired
    UserService userService;


    //删除用户
    @ApiOperation(value = "删除用户",notes = "删除用户")
    @PostMapping(value = "/deleteUser")
    public Object deleteUser(@RequestParam int user_id){
        return userService.deleteUser(user_id);
    }

    //查询单个用户信息
    @ApiOperation(value = "查询单个用户信息",notes = "查询单个用户信息")
    @PostMapping(value = "/selectOneUser")
    public Object selectOneUser(@RequestParam int user_id){
        return userService.selectOneUser(user_id);
    }

    //查看(寻宠/寻主)列表
    @ApiOperation(value = "查看(寻宠/寻主)列表",notes = "种类，品种，关键词")
    @PostMapping(value = "/selectSearchPet")
    public Object selectSearchPet(@RequestParam(required = false) Integer pageNum,
                                  @RequestParam(required = false) Integer pageSize){
        return userService.selectUsers(pageNum,pageSize);
    }


}
